The outbreak of the COVID-19 virus has stoke heavily the world in 2020. While the pandemic increasingly causes damage in all aspects of people's life, no one knows how long it will last. The growth infection over 30 countries in the world have seen the overwhelming power of the exponential spread of epidemic at the early stage. With eventually realizing the serious situation, more and more countries start to take restrictions on people's social interaction. While the classic epidemic models succeed in predicting the exponential growth of infection, whether and to what extent the government's restriction is effective are still hotly debated. Incorporating the external interference to the virus spread model adds complexity and therefore prevents analytic solutions. Hence, I present a spatially explicit social interaction model to simulate how coronavirus spreads among population, in which I consider the dynamic change of the government restriction on social activities according to how serious the pandemic becomes.
The aim of this notebook is to introduce a social-interaction model on individual basis to measure how virus spreads under different government reactions on restriction.
A simulation model is designed. By setting a set of parameters in which the intensity of the government's restriction and the virulence of the virus are of great interest, one can simulate how the infection grows in a given region. Comparing the results of different scenarios may hint at the relation between the epidemic and the government's reaction.
The model is an individual-based model. At each time step, a prescribed number (input as an argument contactsize) of people are sampled at a contact rate $C_{i,j}$ for each individual. The contact rate is affected by multiple factors. First, it depends on the passions to social activities ($Pas_i, Pas_j$) of the focal individual ($i$) and his meeting friend ($j$). If both are active to social interaction, their meeting is likely arranged, thus, leading to a high contact rate. In addition, the passion depends on individual's health state ($D_i$). If one is sick, he is not willing to go out meeting friends. Second, the contact rate is affected by the geographic distance ($d_{i,j}$) between the meeting friends. If they are far away from each other, they are not likely to meet. Third, due to the epidemic development the government restriction has influence on the contact rate. The intensity of the restriction is denoted as ($m(s,N_I)$), which is a function of the number of the infected cases ($N_I$) and the speed of reaction ($s$). Severe restriction is expected to be taken when more infected cases are confirmed, thus, reduces the contact rate to prevent virus spread. Following the intuition, the contact rate is defined as
\begin{align}
C_{i,j} &= e^{-m(N_I)\cdot d^2_{i,j}} \cdot Pas_i(D_i) \cdot Pas_j(D_j)\\
m(s,N_I) &= 2\frac{1}{1+e^{-s\cdot N_I}}-1\\
Pas_i(D_i) &= e^{\frac{(D_i-IP)^2}{V^2}}
\end{align}
where $IP$ denotes the incubation period of the virus and $V$ denotes the virulence of the virus.
The health states are recorded in $D_k,k=1,\cdots,n$, which is related to time elapsed after getting infected. Thus, $D_k = 0$ denotes that the individual just gets infected. At each time step, $D_k$ is added by 1. After a recovery time period (input as an argument recover_time), the infected individual recovers to normal but again become susceptible to the virus. In the future, the mechanism of antibody of the virus that the recovered individuals have a lower chance to be reinfected can be implemented. Back to the model, in such a way recording the health state by elapsed days a dynamic passion to social activities based on one's health state is correctly captured. During the incubation period, the infected individual still has a certain degree of willingness to social interaction because of slight symptoms. After the incubation period, the state of illness of the individual becomes worse, which stops his outing. Eventually, the patient recovers from the illness and becomes active again. Again, in this version, individual death is not modeled for simplicity. The virulence ($V$) determines the sensitivity of this change to the infection.
Before starting simulations, a number of parameters are to be initialized.
A squared region is initialized by setting the width of the grid (grid_size). This also determines the total population size in this region. Each cell hosts one individual. To trigger the epidemic, a number (initial_virus) of infected individuals are launched. At each time step (day), each individual can meet a certain number (contactsize) of friends. The virus is initialized by setting the recovery time length (recover_time), the incubation time length (incubation) and the virulence (virulence). The speed of the government reaction is given by speedreaction. The simulation is implemented in parallel. By default, 4 cpu cores are used, which can be modified by setting num_cores=x.
When the parameters are set, one can check the curves of the following relations to get an idea of the model behavior.
from virusspreadmodel import CoronaSim
test = CoronaSim(grid_size=100, initial_virus=5, contactsize=2,num_cores=6,
recover_time=30, speedreaction=0.01, incubation=10, virulence=25)
test.mechanismcheck()
The first figure shows how active the individual under different health states to the social activities. When the individual is healthy ($D_i=30$), the highest passion rate is assigned, meaning he is willing to have social activities. When the individual gets infected but still under the incubation period ($D_i\in (0,10)$), the individual willingness to have social activities is low. However, because only slight symptom appears the individual still wants to go out. With the symptom become serious, the individual prefers stay at home with lowest contact willingness to others. Again, when the individual eventually recovers from the illness, his willingness recovers as well. Instead of Eq. 3, functions of other forms that show different mechanisms can be applied.
The second figure shows the curve of the contact level against geographic distance ($e^{-m(N_I)\cdot d^2_{i,j}}$) when there are ($N_I=20$) infected cases given the speed of government reaction (speedreaction). It reflects the spatial contact spirit that people that are far away from each other are not likely to meet.
The third figure shows how the intensity of government restriction changes with the increase of the infected cases.
Now, we can start simulations by setting the number of time steps (t_end) and the output file name (savefile) in a .npz format.
# Start running simulations
result = test.simspread(t_end=30, savefile='outfile3.npz')
Direct to our goal, I want to assess the influence of the government reaction speed on regional pandemic development.Thus, as an illustration, I designed three scenarios with three values to speedreaction, i.e. $0.01,0.1,1$, which account for slow, moderate and fast reaction of the government to take restriction. All the other initial parameters are set the same as follows
from virusspreadmodel import CoronaSim
scenario1 = CoronaSim(grid_size=100, initial_virus=5, contactsize=2, num_cores=6,
recover_time=30, speedreaction=0.01, incubation=7, virulence=25)
result1 = test.simspread(t_end=50, savefile='outfile_sl1.npz')
From the figure below, a large proportion of population is infected when the government reacts slowly (the red growth curve). A plateau is reached because that the government starts to take strict restriction only when too many individuals are infected. In contrast, only a small number of people get infected when the government takes fast response to the pandemic (the green curve). The result indicates that a fast response of the government to pandemic plays a positive in inhibiting virus spread. We also see a second growth phase in the accumulation curve. This is due to that the recovered individuals get infected again. Implementing immune system to the model can resolve this unrealistic issue.
%run ComPlots.py
The number of newly increase of the infected cases is shown below. Again, under fast restriction the curve is more flatten than other speeds.
%run NewAcc.py
This model can be used to measure the behavior of governments in reality. One can compute summary statistics like the slope of the growth at a certain phase to compare the empirical data with the simulated data. In such a way, the speed of government reaction can be estimated. Furthermore, as the information of how virus spread regionally is stored, one can investigate the spread mechanism of the virus.
The model has great potential to extend to a more realistic version. As mentioned above, one can implement immune system in the model to see whether herd immunity is achieved and to what extent it helps stop virus spread.
%run plotclassplotly.py